package com.study.结构型模式.组合模式;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class University extends OrganizationComponent{
    private List<OrganizationComponent>organizationComponents = new LinkedList<>();

    public University(String name, String des) {
        super(name, des);
    }

    @Override
    protected void print() {
        System.out.println("=========="+getName()+"===========");
        for (OrganizationComponent organizationComponent : organizationComponents) {
            organizationComponent.print();
        }
    }

    @Override
    protected void add(OrganizationComponent organizationComponent) {
        organizationComponents.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        organizationComponents.remove(organizationComponent);
    }
}
